<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel=stylesheet href="css/style.css" type="text/css">
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://struts.apache.org/tags-html-el" prefix="html" %>
<title>Fantacalcio | User: ${user.username }</title>
</head>
<body>
	<c:if test="${userInSession == null }">
		<c:redirect url="Logout.do"></c:redirect>
	</c:if>
		
	<c:import url="/head.jsp"/>
	
	<c:import url="/menu.jsp"/>
	
	<c:import url="menuUser.jsp"/>
	
	<div class="context">
		<h1> User: ${user.username } </h1>
		<table>
			<tr>
				<td><label class="prop">Id:</label></td>
				<td>${user.id}</td>
			</tr>
			<tr>
				<td><label class="prop">Nome:</label></td>
				<td>${user.nome}</td>
			</tr>
			<tr>
				<td><label class="prop">Cognome:</label></td>
				<td>${user.cognome }</td>
			</tr>
			<tr>
				<td><label class="prop">Username:</label></td>
				<td>${user.username }</td>
			</tr>
			<c:if test="${userInSession.role.codRole == 'ADMIN' }">
				<tr>
					<td><label class="prop">Attivo:</label></td>
					<td>${user.attivo }</td>
				</tr>
				<tr>
					<td><label class="prop">Ruolo:</label></td>
					<td>${user.role.codRole }</td>
				</tr>
			</c:if>
		</table>
		<c:if test="${userInSession.role.codRole == 'ADMIN'}">
			<html:form action="PrepareCRUDUserAction.do" styleId="formuser">
			<html:hidden property="id" value="${user.id }"/>
			<html:hidden property="codOp" value="modifica"/>
			<div class="bottomS"><html:submit value="Modifica" /></div>
			</html:form>
			<html:form action="ConfermaDeleteUserAction.do" styleId="formuser">
			<html:hidden property="id" value="${user.id }"/>
			<html:hidden property="codOp" value="cancella"/>
			<div class="bottomD"><html:submit value="Cancella"  onclick="return confirm('Confermare cancellazione?');"/></div>
			</html:form>
		</c:if>
	</div>
	
	<c:import url="/footer.jsp"/>

</body>
</html>